*****
*** Paper: Optimal Ownership and Firm Performance: An Analysis of China’s FDI Liberalization
*** Authors: Peter Eppinger (PE), Hong Ma (HM)
*** Purpose: Master do-file running data preparation and analysis replicating all results in the paper and in the Online Appendix
*** Stata version: 16.1
*** Date: February 20, 2024
***

** General settings

cap log close
clear all
set more off, perm
set varabbrev off, perm
set maxvar 32000


** Set working directory and paths

cd "" // choose working directory

* directories for code, data, and results
global code "code"
global working_data "data"
global proprietary_data "data\proprietary_data"
global prepared_data "data\data_use" // empty folder for prepared working data
global results "results" // empty folder for results
cap mkdir "data\data_use"
cap mkdir "results"


** Install packages (if necessary)

ssc install unique, replace
ssc install reghdfe, replace
ssc install ftools, replace
ssc install psmatch2, replace
ssc install estout, replace
ssc install coefplot, replace
ssc install honestdid, replace


** Run code

do "$code\1_FDI_liberalization_dataprep.do"
do "$code\2_FDI_liberalization_analysis.do"
do "$code\3_FDI_liberalization_appendixA.do"


** End of file
cap log close
exit, clear
